package com.sgb.kjwl.view.ui.adapter.home;

import android.content.Context;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.BuildEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.MDateUtil;

import java.util.List;

public class BuildAdapter extends BaseRecycleAdapter<BuildEntity> {

    private TextView areaView;
    private TextView empView;
    private TextView timeView;

    public BuildAdapter(Context context, List<BuildEntity> datas) {
        super(context, R.layout.item_build, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final BuildEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        areaView = holder.getItem().findViewById(R.id.area_view);
        empView = holder.getItem().findViewById(R.id.emp_view);
        timeView = holder.getItem().findViewById(R.id.time_view);
        try {
            timeView.setText(MDateUtil.getByTimestamp(Long.parseLong(entity.getUpdateTime()), MDateUtil.Format.FORMART5.name));
        } catch (NumberFormatException e) {

        }
        areaView.setText("服务区域：" + entity.getArea());
        empView.setText("队伍规模：" + entity.getScale() + "人");

    }

}
